<template>
  <a-table size="middle" :dataSource="dataSource" :columns="columns"> </a-table>
</template>
<script lang="ts" setup>
import { ref, defineProps, onMounted } from 'vue';
import { listFile } from '#/api';
import type { ContractSo, ContractPageVo, ContractFileDto } from '#/api/common';
const loading = ref(false);
const props = defineProps({
  id: {
    type: String,
    required: true,
  },
});
const dataSource = ref<ContractFileDto[]>([]);
const columns = [
  {
    title: '文件名称',
    dataIndex: 'fileName',
    key: 'fileName',
    align: 'center',
  },

  {
    title: '文件类型',
    dataIndex: 'fileType',
    key: 'fileType',
    width: 160,
    align: 'center',
  },
  {
    title: '文件大小',
    dataIndex: 'fileSize',
    key: 'fileSize',
    width: 160,
    align: 'center',
  },
  {
    title: '操作',
    dataIndex: 'operation',
    key: 'operation',
    width: 250,
    align: 'center',
  },
];

onMounted(() => {
  list();
});

async function list() {
  loading.value = true;
  const res = await listFile(props.id);
  console.log('res', res);
  dataSource.value = res;
  loading.value = false;
}
</script>
